import { pubRequire } from '@utils/public'
const baseUrl = '/channel/topics'
const baseUrl2 = '/channel/topics/posts/reviews/contents'
const baseUrl3 = '/channel/topics/posts/reviews/comments'

// 获取话题字典
export function getTopicOptions(callBack, errBack) {
  return pubRequire('get', `/channel/topic/options`, {}, callBack, errBack)
}

// 获取话题列表
export function getTopicPostList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl}/posts`, obj, callbBack, errBack)
}


//获取最新编辑者
export function editor(id, callbBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/posts/${id}/latest-editor`,
    '',
    callbBack,
    errBack
  )
}

//修改虚拟分享量
export function changeShare(id, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/posts/${id}/share-counts/${obj.num}`,
    {},
    callbBack,
    errBack
  )
}

//修改虚拟分播放量
export function changePlay(id, obj, callbBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/posts/${id}/play-counts/${obj.num}`,
    {},
    callbBack,
    errBack
  )
}

//单个删除
export function delSingle(obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl}/posts`, obj, callbBack, errBack)
}

//置顶
export function top(id, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/posts/${id}/top`, obj, callbBack, errBack)
}

//取消置顶
export function unTop(id, obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl}/posts/${id}/untop`, obj, callbBack, errBack)
}

// 话题帖子内容审核列表
export function getTopicCheckList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl2}`, obj, callbBack, errBack)
}

// 话题帖子内容审核通过
export function pass(obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl2}/pass`, obj, callbBack, errBack)
}

// 话题帖子内容审核不通过
export function unPass(obj, callbBack, errBack) {
  return pubRequire('delete', `${baseUrl2}/unpass`, obj, callbBack, errBack)
}

// 话题评论审核列表
export function getTopicCommentCheckList(obj, callbBack, errBack) {
  return pubRequire('get', `${baseUrl3}`, obj, callbBack, errBack)
}

// 话题评论审核通过
export function commentPass(obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl3}/pass`, obj, callbBack, errBack)
}

// 话题评论审核不通过
export function commentUnPass(obj, callbBack, errBack) {
  return pubRequire('put', `${baseUrl3}/unpass`, obj, callbBack, errBack)
}